#include <bits/stdc++.h>

#include <unordered_set>

#define ll long long
#define ull unsigned long long
#define uint unsigned int

#define YES cout << "YES" << '\n'
#define NO cout << "NO" << '\n'
#define endl '\n'
const int INF = 1e9;
const int MOD = 998244353;
using namespace std;

/*思考  C. 前缀最小和后缀最大
如果一个数可以成为前缀最小和后缀最大
那么它就可以成为数组中的最大值
*/

void solve()
{
    int n = 0;
    cin >> n;
    vector<int> a(n + 1);
    vector<int> pre(n + 1, INF);
    vector<int> suf(n + 2, 0);
    for (int i = 1; i <= n; i++)
    {
        cin >> a[i];
        pre[i] = min(pre[i - 1], a[i]);
    }
    for (int i = n; i >= 1; i--)
    {
        suf[i] = max(suf[i + 1], a[i]);
    }
    for (int i = 1; i <= n; i++)
    {
        if (a[i] == pre[i] || a[i] == suf[i])
        {
            cout << 1;
        }
        else
        {
            cout << 0;
        }
    }
    cout << endl;
}
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    int t = 0;
    cin >> t;
    while (t--)
    {
        solve();
    }
    return 0;
}